{{include template('public/header','admin')}}
</head>
<body>
    <div class="container">
        <div style="margin: 20px;">
            <form action="{{url($postUrl)}}" method="post" class="form-horizontal" id="cpform" name="cpform" role="form" autocomplete='off' onsubmit="return dosub(this)" >
                <input type='hidden' name='uid' value="{{$item['uid']}}" />
                <div class="form-group">
                    <label for="username" class="col-sm-2 control-label">{{L('member_username')}}</label>
                    <div class="col-sm-10 form-inline">
                        <input type="text" id="username" name='username' value="{{$item.username}}" maxlength="15" tabindex="2" class='form-control' required="required"/>
                    </div>
                </div>
                <div class="form-group">
                    <label for="email" class="col-sm-2 control-label">{{L('member_email')}}</label>
                    <div class="col-sm-10 form-inline">
                        <input type="text" id="email" name='email' value="{{$item.email}}" maxlength="90" tabindex="4" class='form-control' required="required"/>
                    </div>
                </div>
                <div class="form-group">
                    <label for="groupid" class="col-sm-2 control-label">用户组</label>
                    <div class="col-sm-10 form-inline">
                        {{showselectusergroup($item['groupid'])}}
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type='submit' name='dosubmit' class='btn  btn-default' value='提交' />
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        function dosub(obj) {
            var reg = /^[A-Za-z]+$/;
            if (obj.username.value == '') {
                layer.msg('用户名不能为空！');
                return false;
            }
            if (obj.email.value == '') {
                layer.msg('email不能为空！');
                return false;
            }
            if ($("select[name='groupid']").val() == '0') {
                layer.msg('请选择用户组！');
                return false;
            }
            $.ajax({
                type: 'POST',
                url: '{{url($postUrl)}}',
                data: $(obj).serialize(),
                dataType: "json",
                success: function (ret) {
                    if (ret.status=="y") {
                        parent.location.reload();
                    } else {
                        layer.msg(ret.info);
                    }
                }
            });
            return false;
        }

    </script>
</body>
</html>

